package br.sceweb.testeIntegracao;

import static org.junit.Assert.assertEquals;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;

import br.sceweb.dominio.Convenio;
import br.sceweb.dominio.Fachada;
import br.sceweb.servico.DAOFactory;
import br.sceweb.servico.IConvenioDAO;

public class UC06ConsultarConvenio {

	static Fachada fachada;
	static String cnpj=null;
	static IConvenioDAO daoConvenio;
	static Convenio convenio;
	
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		
		fachada = new Fachada();
		daoConvenio =  DAOFactory.getDAOFactory(1).getConvenioDAO();
		convenio =  new Convenio();
		
		cnpj = "89424232000180";
		
		convenio.setCnpj(cnpj);
		convenio.setDataInicio("12/01/2014");
		convenio.setDataTermino("12/12/2014");
		
		daoConvenio.cadastra(convenio);
		
	}
	
	@Test
	public void UC06FBCT01ConsultaConvenio_CNPJ_com_Sucesso() 
	{
		assertEquals(1,daoConvenio.consulta(cnpj).size());
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
		daoConvenio.exclui(cnpj);
	}

	

}
